﻿using System;
using System.Threading;
using System.Windows;
using System.Windows.Media.Animation;
using EzDesk.DesktopClient.FunctionWindowModule.ViewContract;
using EzDesk.DesktopClient.UtilityView.ViewModel;
using EzDesk.Generic;
using EzDesk.Generic.WPF;
using EzDesk.DesktopClient.ViewBase;
using EzDesk.MVVMBase;

namespace EzDesk.DesktopClient.FunctionWindowModule.View
{
    /// <summary>
    /// Interaction logic for FunctionPageView.xaml
    /// </summary>
    public partial class ActionView : WindowExtenBase, IActionView
    {

        public ActionView()
        {
            InitializeComponent();
            this.Dispatcher.BeginInvoke(new Action(this.Init));
        }

        private void Init()
        {
            this.ToBeTop().ToBeside(Application.Current.MainWindow);
            ShowInTaskbar = false;
        }

        public void FlashShow()
        {
            this.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        this.Show();
                        var story = (Storyboard)this.FindResource("FlashShow");
                        this.BeginStoryboard(story);
                        story.Begin(this,true);
                        story.Completed += (o, e) =>Hide();
                                               
                    }));

        }

        public override IWindowView ShowWindowView()
        {
            var story = (Storyboard)this.FindResource("PopShow");
            this.BeginStoryboard(story);
            story.Begin(this, true);
            base.ShowWindowView();
            return this;
        }
        protected void CloseBtn_Click(object sender, RoutedEventArgs e)
        {
            this.Hide();
        }
    }
}
